<html>
<head><meta charset="utf-8"><title>impl-trait-in-bindings · wg-traits · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/index.html">wg-traits</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html">impl-trait-in-bindings</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="147262561"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147262561" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147262561">(Nov 07 2018 at 22:51)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> any more ideas about fixing <code>impl Trait</code> in bindings before I get going on it?</p>



<a name="147262565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147262565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147262565">(Nov 07 2018 at 22:51)</a>:</h4>
<p>based off your previous advice</p>



<a name="147274028"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147274028" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147274028">(Nov 08 2018 at 03:04)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> <span class="user-mention" data-user-id="131694">@scalexm</span> Hmm. How do I get the predicates for an impl Trait <code>ty::Ty</code> during type checking? (the <code>TyKind</code> contains a <code>DefId</code> and <code>Substs</code>, but now sure how that helps directly.) <code>predicate_for_trait_def</code> seems <em>almost</em> right, but I guess that only works if the <code>DefId</code> passed in is for a trait, not an impl Trait type?</p>



<a name="147274506"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147274506" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147274506">(Nov 08 2018 at 03:18)</a>:</h4>
<p>also, the coercion routine <code>coerce_unsized</code> is slightly confusing me... is the aim to create the most granular obligations possible? and is this needed for my corresponding approach for coercing to opaque types?</p>



<a name="147274512"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147274512" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147274512">(Nov 08 2018 at 03:18)</a>:</h4>
<p>I think if I figure this out, I can continue making good progress.</p>



<a name="147274514"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147274514" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147274514">(Nov 08 2018 at 03:18)</a>:</h4>
<p>already made some.</p>



<a name="147290341"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147290341" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147290341">(Nov 08 2018 at 10:31)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> I'm not sure to understand what you're asking for</p>



<a name="147290387"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147290387" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147290387">(Nov 08 2018 at 10:32)</a>:</h4>
<p>if you want the list of generic predicates on the <code>impl Trait</code> type, you can just call <code>tcx.predicates_of(def_id)</code></p>



<a name="147312340"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147312340" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147312340">(Nov 08 2018 at 16:46)</a>:</h4>
<p><span class="user-mention" data-user-id="131694">@scalexm</span> sure, but that doesn’t take into account the Substs no?</p>



<a name="147312354"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147312354" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147312354">(Nov 08 2018 at 16:46)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> you can do <code>tcx.predicates_of(def_id).instantiate(substs)</code> or something</p>



<a name="147312402"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147312402" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147312402">(Nov 08 2018 at 16:47)</a>:</h4>
<p>and then if you want a <code>PredicateObligations</code> in the end you can use <code>traits::predicates_for_generics</code></p>



<a name="147314491"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147314491" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147314491">(Nov 08 2018 at 17:17)</a>:</h4>
<p><span class="user-mention" data-user-id="131694">@scalexm</span> aha, perfect. thank you.</p>



<a name="147314607"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147314607" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147314607">(Nov 08 2018 at 17:19)</a>:</h4>
<p><span class="user-mention" data-user-id="131694">@scalexm</span> there's no recursive procedure involved here, like there is with <code>coerce_unsize</code>, right?</p>



<a name="147315268"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147315268" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147315268">(Nov 08 2018 at 17:30)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> mmh I don't know how <code>coerce_unsize</code> works</p>



<a name="147315450"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147315450" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147315450">(Nov 08 2018 at 17:33)</a>:</h4>
<p><span class="user-mention" data-user-id="131694">@scalexm</span> no worries. one final thing (for now!): what is <code>body_id</code> for an <code>Obligation</code> (some sort of context I guess?), and why is it only relevant if the predicate is a trait-ref?</p>



<a name="147315817"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147315817" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147315817">(Nov 08 2018 at 17:39)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> you around by chance?</p>



<a name="147316226"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147316226" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147316226">(Nov 08 2018 at 17:46)</a>:</h4>
<p>I'm wondering what this LUB relationship checking is for</p>



<a name="147316561"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147316561" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147316561">(Nov 08 2018 at 17:51)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> according to the doc it is needed for regions checking but I don't know much more =)</p>



<a name="147316623"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147316623" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147316623">(Nov 08 2018 at 17:52)</a>:</h4>
<p>but if you work with opaque types, I guess this is just the <code>NodeId</code> of the function defining your opaque type</p>



<a name="147316677"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147316677" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147316677">(Nov 08 2018 at 17:53)</a>:</h4>
<p><span class="user-mention" data-user-id="131694">@scalexm</span> hmm... not where the opaque type is used?</p>



<a name="147317005"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147317005" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147317005">(Nov 08 2018 at 17:58)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span>  well I was guessing that by reading the code in <code>typeck_tables_of</code></p>



<a name="147317761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147317761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147317761">(Nov 08 2018 at 18:09)</a>:</h4>
<p>hmm</p>



<a name="147317834"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147317834" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147317834">(Nov 08 2018 at 18:10)</a>:</h4>
<p><span class="user-mention" data-user-id="131694">@scalexm</span> incidentally, there's an <code>instantiate_bounds</code> fn too, which does something similar to what you said above, but takes a span (which I wouldn't know how to provide)</p>



<a name="147317897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147317897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147317897">(Nov 08 2018 at 18:11)</a>:</h4>
<p>ah</p>



<a name="147317899"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147317899" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147317899">(Nov 08 2018 at 18:11)</a>:</h4>
<p>maybe <code>self.cause.span</code></p>



<a name="147322364"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147322364" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147322364">(Nov 08 2018 at 19:22)</a>:</h4>
<p>ugh, factoring out the reborrow code into its own function is creating all sorts of lifetime mayhem</p>



<a name="147322657"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147322657" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147322657">(Nov 08 2018 at 19:27)</a>:</h4>
<p>I think it's an NLL thing</p>



<a name="147322661"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147322661" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147322661">(Nov 08 2018 at 19:27)</a>:</h4>
<p>wish I could turn it on in the compiler :-P</p>



<a name="147323305"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147323305" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147323305">(Nov 08 2018 at 19:37)</a>:</h4>
<p>(deleted)</p>



<a name="147324867"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147324867" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147324867">(Nov 08 2018 at 19:59)</a>:</h4>
<p>okay, making headway at last!</p>



<a name="147325522"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147325522" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147325522">(Nov 08 2018 at 20:09)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> <span class="user-mention" data-user-id="131694">@scalexm</span> do I still need to <code>instantiate_opaque_types_from_value</code> in <code>typeck_tables_of</code>? if not, I need to modify the type somewhere else.</p>



<a name="147327153"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147327153" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scalexm <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147327153">(Nov 08 2018 at 20:31)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> I think niko might be able to produce an answer more easily, I'm not very familiar with this code :/</p>



<a name="147328876"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147328876" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147328876">(Nov 08 2018 at 21:00)</a>:</h4>
<p><span class="user-mention" data-user-id="131694">@scalexm</span> no worries</p>



<a name="147328902"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147328902" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147328902">(Nov 08 2018 at 21:01)</a>:</h4>
<p>Hopefully he’ll be around later</p>



<a name="147343497"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147343497" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147343497">(Nov 09 2018 at 01:18)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> in fact, <code>typeck_tables</code> isn't the only places; there are others. but the question remains: do I need to call <code>instantiate_opaque_types_from_value</code> for types of or within bindings, under this new approach?</p>



<a name="147343918"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147343918" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147343918">(Nov 09 2018 at 01:28)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> it seems kind of incompatible with the coercion-based approach. but maybe I'm missing something?</p>



<a name="147343999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147343999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147343999">(Nov 09 2018 at 01:30)</a>:</h4>
<p>if the coercion routine (<code>coerce_hidden</code>) itself calls <code>instantiate_opaque_types_from_value</code>, then it needs to know the parent fn ID, which is kind of awkward, and seems hacky. (and I don't even know what happens in the case the existential type is at the top level, i.e. no parent id.)</p>



<a name="147346181"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147346181" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147346181">(Nov 09 2018 at 02:31)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> you can see my attempt so far at <a href="https://github.com/rust-lang/rust/pull/55807" target="_blank" title="https://github.com/rust-lang/rust/pull/55807">https://github.com/rust-lang/rust/pull/55807</a></p>



<a name="147441293"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147441293" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147441293">(Nov 10 2018 at 17:34)</a>:</h4>
<p>Made some good progress now, by the way. Will push soon. :-)</p>



<a name="147441298"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147441298" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147441298">(Nov 10 2018 at 17:34)</a>:</h4>
<p>Sorry if I was pinging you too much last week. I forgot you were at the conference once or twice, and are a busy man. My bad.</p>



<a name="147619214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147619214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147619214">(Nov 13 2018 at 19:33)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I'm going to go out for the day, so last chance to talk, FYI</p>



<a name="147619438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147619438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147619438">(Nov 13 2018 at 19:36)</a>:</h4>
<p>otherwise just feel free to leave me notes ;-)</p>



<a name="147619445"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147619445" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147619445">(Nov 13 2018 at 19:36)</a>:</h4>
<p>I could share the MIR with you now if you like though</p>



<a name="147620027"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147620027" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147620027">(Nov 13 2018 at 19:46)</a>:</h4>
<p><a href="/user_uploads/4715/zjpsIe8UlOW0jAVneXoxyiA5/mir_dump.zip" target="_blank" title="mir_dump.zip">mir_dump.zip</a></p>



<a name="147620032"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147620032" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147620032">(Nov 13 2018 at 19:46)</a>:</h4>
<p>there you go, in fact ^</p>



<a name="147620090"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147620090" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147620090">(Nov 13 2018 at 19:47)</a>:</h4>
<p><a href="/user_uploads/4715/AQCJg5EzV_EFrMT-TRxfnFyR/impllet_a.rs" target="_blank" title="impllet_a.rs">impllet_a.rs</a>  -- the test file</p>



<a name="147620149"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147620149" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147620149">(Nov 13 2018 at 19:48)</a>:</h4>
<p>codegen error output:</p>
<div class="codehilite"><pre><span></span>error: internal compiler error: librustc_codegen_llvm/mir/block.rs:753: codegen_argument: OperandRef(Immediate((i8**:  %4 = alloca i8*, align 8)) @ TyLayout { ty: &amp;dyn std::ops::Fn() -&gt; i32 + std::panic::RefUnwindSafe + std::marker::Sync, details: LayoutDetails { variants: Single { index: 0 }, fields: Arbitrary { offsets: [Size { raw: 0 }, Size { raw: 8 }], memory_index: [0, 1] }, abi: ScalarPair(Scalar { value: Pointer, valid_range: 1..=18446744073709551615 }, Scalar { value: Pointer, valid_range: 1..=18446744073709551615 }), align: Align { abi_pow2: 3, pref_pow2: 3 }, size: Size { raw: 16 } } }) invalid for pair argument

thread &#39;main&#39; panicked at &#39;encountered error with `-Z treat_err_as_bug&#39;, librustc_errors/lib.rs:500:13
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
   1: std::sys_common::backtrace::print
   2: std::panicking::default_hook::{{closure}}
   3: std::panicking::default_hook
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
   6: std::panicking::begin_panic
   7: rustc_errors::Handler::emit_db
   8: rustc_errors::Handler::bug
   9: rustc::util::bug::opt_span_bug_fmt::{{closure}}
  10: rustc::ty::context::tls::with_opt::{{closure}}
  11: rustc::ty::context::tls::with_context_opt
  12: rustc::ty::context::tls::with_opt
  13: rustc::util::bug::opt_span_bug_fmt
  14: rustc::util::bug::bug_fmt
  15: rustc_codegen_llvm::mir::block::&lt;impl rustc_codegen_llvm::mir::FunctionCx&lt;&#39;a, &#39;ll, &#39;tcx&gt;&gt;::codegen_argument
  16: rustc_codegen_llvm::mir::block::&lt;impl rustc_codegen_llvm::mir::FunctionCx&lt;&#39;a, &#39;ll, &#39;tcx&gt;&gt;::codegen_terminator
  17: rustc_codegen_llvm::mir::codegen_mir
  18: rustc_codegen_llvm::base::codegen_instance
  19: rustc_codegen_llvm::mono_item::MonoItemExt::define
  20: rustc_codegen_llvm::base::compile_codegen_unit::module_codegen
...
</pre></div>



<a name="147620151"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147620151" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147620151">(Nov 13 2018 at 19:48)</a>:</h4>
<p>bye for now!</p>



<a name="147766317"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147766317" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147766317">(Nov 15 2018 at 19:24)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> regarding your recent notes (thanks for those), was there any reason you suggested to use <code>instantiate_opaque_types</code> in the nll type checking part rather than regular type checking?</p>



<a name="147766319"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147766319" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147766319">(Nov 15 2018 at 19:24)</a>:</h4>
<p>I thought it needed to be used <em>somewhere</em>, but not sure why there</p>



<a name="147990016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147990016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147990016">(Nov 19 2018 at 19:52)</a>:</h4>
<p>Heh <span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> I'm not sure I'll have to re-review</p>



<a name="147991142"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147991142" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147991142">(Nov 19 2018 at 20:06)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> no worries.</p>



<a name="147991166"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/147991166" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#147991166">(Nov 19 2018 at 20:07)</a>:</h4>
<p>your existing advice is helpful... though I haven't turned my attention properly to that PR yet :-)</p>



<a name="148184294"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148184294" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148184294">(Nov 22 2018 at 16:17)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> let me know when you get a chance to look at that one little point again...</p>



<a name="148237062"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148237062" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148237062">(Nov 23 2018 at 15:56)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> it's literally just the thing about where to do the type instantiation for opaque types (in normal type checking or NLL)</p>



<a name="148824498"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148824498" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148824498">(Nov 29 2018 at 22:21)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I presume you didn't forget about the above...</p>



<a name="148889002"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148889002" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148889002">(Nov 30 2018 at 21:00)</a>:</h4>
<p>ok circling back to this now :)</p>



<a name="148889003"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148889003" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148889003">(Nov 30 2018 at 21:00)</a>:</h4>
<p>sorry</p>



<a name="148889034"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148889034" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148889034">(Nov 30 2018 at 21:00)</a>:</h4>
<p>is the remaining question to be found in <a href="https://github.com/rust-lang/rust/pull/55807" target="_blank" title="https://github.com/rust-lang/rust/pull/55807">https://github.com/rust-lang/rust/pull/55807</a> ?</p>



<a name="148891452"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148891452" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148891452">(Nov 30 2018 at 21:39)</a>:</h4>
<p>Hi</p>



<a name="148891453"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148891453" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148891453">(Nov 30 2018 at 21:39)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> mainly about this comment <a href="https://github.com/rust-lang/rust/pull/55807#discussion_r233631877" target="_blank" title="https://github.com/rust-lang/rust/pull/55807#discussion_r233631877">https://github.com/rust-lang/rust/pull/55807#discussion_r233631877</a></p>



<a name="148891501"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148891501" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148891501">(Nov 30 2018 at 21:40)</a>:</h4>
<p>and whether it would actually be better to do <code>instantiate_opaque_types</code> in normal type checking, rather than NLL type checking as you suggested?</p>



<a name="148891521"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148891521" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148891521">(Nov 30 2018 at 21:40)</a>:</h4>
<p>also, I'm slightly struggling to see how opaque type instantiation and coercion fit together. maybe this relates to your last review comment.</p>



<a name="148892354"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148892354" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148892354">(Nov 30 2018 at 21:56)</a>:</h4>
<blockquote>
<p>and whether it would actually be better to do <code>instantiate_opaque_types</code> in normal type checking, rather than NLL type checking as you suggested?</p>
</blockquote>
<p>Ah. I think we're going to have to do it in <em>both</em> places probably, ultimately</p>



<a name="148892366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148892366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148892366">(Nov 30 2018 at 21:56)</a>:</h4>
<p>but let me re-read whatI wrote</p>



<a name="148892483"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148892483" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148892483">(Nov 30 2018 at 21:59)</a>:</h4>
<p>sure :-)</p>



<a name="148893179"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148893179" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148893179">(Nov 30 2018 at 22:11)</a>:</h4>
<p>(I'm reading a bit into the way that <code>impl Trait</code> works now, it's changed as a result of <span class="user-mention" data-user-id="124288">@Oli</span>'s excellent refactorings...)</p>



<a name="148893304"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148893304" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148893304">(Nov 30 2018 at 22:13)</a>:</h4>
<p>aha</p>



<a name="148893314"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148893314" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148893314">(Nov 30 2018 at 22:13)</a>:</h4>
<p>how recently did it change? :-)</p>



<a name="148893383"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148893383" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148893383">(Nov 30 2018 at 22:14)</a>:</h4>
<p>not <em>that</em> recently</p>



<a name="148893393"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148893393" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148893393">(Nov 30 2018 at 22:14)</a>:</h4>
<p>so when I say "defining use" does that mean anything to you? :)</p>



<a name="148893440"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148893440" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148893440">(Nov 30 2018 at 22:15)</a>:</h4>
<p>similarly, do you <a href="https://github.com/rust-lang/rust/blob/d09466ceb1374bd0ff1c490bfd50133b8ca67558/src/librustc/infer/opaque_types/mod.rs#L700-L717" target="_blank" title="https://github.com/rust-lang/rust/blob/d09466ceb1374bd0ff1c490bfd50133b8ca67558/src/librustc/infer/opaque_types/mod.rs#L700-L717">grok what this code is trying to do</a>?</p>



<a name="148893457"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148893457" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148893457">(Nov 30 2018 at 22:15)</a>:</h4>
<p>e.g., the distinction between <a href="https://github.com/rust-lang/rust/blob/d09466ceb1374bd0ff1c490bfd50133b8ca67558/src/librustc/infer/opaque_types/mod.rs#L671-L680" target="_blank" title="https://github.com/rust-lang/rust/blob/d09466ceb1374bd0ff1c490bfd50133b8ca67558/src/librustc/infer/opaque_types/mod.rs#L671-L680">these two different uses of the abtract type <code>Foo</code></a>?</p>



<a name="148893779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148893779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148893779">(Nov 30 2018 at 22:21)</a>:</h4>
<p>(trying to calibrate how much you've read into that code)</p>



<a name="148893878"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148893878" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148893878">(Nov 30 2018 at 22:23)</a>:</h4>
<p>intuitively, "defining use" makes sense, I think</p>



<a name="148893881"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148893881" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148893881">(Nov 30 2018 at 22:23)</a>:</h4>
<p>let me see...</p>



<a name="148893964"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148893964" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148893964">(Nov 30 2018 at 22:25)</a>:</h4>
<p>ah yes</p>



<a name="148894012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148894012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148894012">(Nov 30 2018 at 22:26)</a>:</h4>
<p>so... I'm guessing we want to instantiate opaque types in the case of defining uses, but coerce in the other case?</p>



<a name="148894064"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148894064" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148894064">(Nov 30 2018 at 22:27)</a>:</h4>
<p>^ <span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="148894772"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148894772" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148894772">(Nov 30 2018 at 22:41)</a>:</h4>
<p>Right. But here the "defining use" definition gets more complex than before; we used to only consider the <code>parent_def_id</code></p>



<a name="148894776"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148894776" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148894776">(Nov 30 2018 at 22:41)</a>:</h4>
<p>but we now want to be at the granularity of a specific let statement</p>



<a name="148894849"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148894849" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148894849">(Nov 30 2018 at 22:42)</a>:</h4>
<p>yeah, I was wondering about that... sounds like you're right.</p>



<a name="148894853"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148894853" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148894853">(Nov 30 2018 at 22:42)</a>:</h4>
<p>we might want some kind of separate fn that says</p>



<a name="148894867"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148894867" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148894867">(Nov 30 2018 at 22:42)</a>:</h4>
<p>er</p>



<a name="148894876"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148894876" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148894876">(Nov 30 2018 at 22:42)</a>:</h4>
<p>we might want to refactor it sort of so that it is given a kind of "context"</p>



<a name="148894877"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148894877" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148894877">(Nov 30 2018 at 22:42)</a>:</h4>
<p>let statement or assignment could be the defining use now, right?</p>



<a name="148894903"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148894903" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148894903">(Nov 30 2018 at 22:43)</a>:</h4>
<p>yes but</p>



<a name="148894904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148894904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148894904">(Nov 30 2018 at 22:43)</a>:</h4>
<p>hmm, how do you mean exactly?</p>



<a name="148894961"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148894961" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148894961">(Nov 30 2018 at 22:44)</a>:</h4>
<p>sorry I'm getting interrupted here :)</p>



<a name="148894962"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148894962" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148894962">(Nov 30 2018 at 22:44)</a>:</h4>
<p>not being very clear</p>



<a name="148894967"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148894967" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148894967">(Nov 30 2018 at 22:44)</a>:</h4>
<p>I'm also not sure what I would do :P</p>



<a name="148894973"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148894973" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148894973">(Nov 30 2018 at 22:44)</a>:</h4>
<p>I can see a few ways of approaching it</p>



<a name="148895004"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895004" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895004">(Nov 30 2018 at 22:45)</a>:</h4>
<p>but in any case, what we want is that:</p>
<p>when you have a <code>let</code>, we invoke <code>instantiate_opaque_types</code> on the type annotation. This is considered the 'defining use' for any <code>impl Trait</code> that appeared within that <code>let</code>, just as the "return type" is the "defining use" for <code>impl Trait</code> in <em>that</em> position</p>



<a name="148895012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895012">(Nov 30 2018 at 22:45)</a>:</h4>
<p>other opaque types are left alone :)</p>



<a name="148895076"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895076" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895076">(Nov 30 2018 at 22:46)</a>:</h4>
<p>thinking more about it, I think we do not have to modify the <code>coercion.rs</code> code</p>



<a name="148895089"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895089" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895089">(Nov 30 2018 at 22:46)</a>:</h4>
<p>once we get the <code>instantiate_opaque_type</code> call correct, you will basically wind up with a set of types that (may) include inference variables</p>



<a name="148895112"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895112" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895112">(Nov 30 2018 at 22:46)</a>:</h4>
<p>these are what we coerce <em>to</em></p>



<a name="148895139"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895139" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895139">(Nov 30 2018 at 22:47)</a>:</h4>
<p>then there is one <em>add'l</em> coercion atop that (maybe not treated as a "adjustment", maybe added in some other way, but I think it should appear in the MIR, where this context is gone) that "casts" to the opaque types</p>



<a name="148895148"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895148" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895148">(Nov 30 2018 at 22:47)</a>:</h4>
<p>right</p>



<a name="148895152"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895152" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895152">(Nov 30 2018 at 22:47)</a>:</h4>
<p>makes sense</p>



<a name="148895234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895234">(Nov 30 2018 at 22:48)</a>:</h4>
<p>but the code I wrote for coercion to opaque types more or less makes sense, I think... no?</p>



<a name="148895237"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895237" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895237">(Nov 30 2018 at 22:48)</a>:</h4>
<p>that should stay?</p>



<a name="148895275"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895275" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895275">(Nov 30 2018 at 22:49)</a>:</h4>
<p>I think you don't want it</p>



<a name="148895277"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895277" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895277">(Nov 30 2018 at 22:49)</a>:</h4>
<p>or need it</p>



<a name="148895295"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895295" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895295">(Nov 30 2018 at 22:49)</a>:</h4>
<p>let me go look again though</p>



<a name="148895299"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895299" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895299">(Nov 30 2018 at 22:49)</a>:</h4>
<p>that was the code in <a href="http://coercion.rs" target="_blank" title="http://coercion.rs">coercion.rs</a>?</p>



<a name="148895305"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895305" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895305">(Nov 30 2018 at 22:50)</a>:</h4>
<p>we might want it somewhere else</p>



<a name="148895379"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895379" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895379">(Nov 30 2018 at 22:50)</a>:</h4>
<p>well, I added a MIR "hiding" operation</p>



<a name="148895380"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895380" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895380">(Nov 30 2018 at 22:50)</a>:</h4>
<p>this "cast" in the MIR I'm talking about; presumably it has the form of a kind of "user-assert ty". That is, it has to have the type that the user gave (with <code>impl Trait</code>) and it knows it is the defining use for those types (so it can invoke the <code>instantiate</code> again)</p>



<a name="148895388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895388">(Nov 30 2018 at 22:51)</a>:</h4>
<p>ok I see <em>that</em> code is probably basically right</p>



<a name="148895396"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895396" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895396">(Nov 30 2018 at 22:51)</a>:</h4>
<p>though I've forgotten just how it looked</p>



<a name="148895412"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895412" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895412">(Nov 30 2018 at 22:51)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> but the <code>coerce_hidden</code> code is probably what you'd remove, or what?</p>



<a name="148895513"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895513" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895513">(Nov 30 2018 at 22:53)</a>:</h4>
<p>anyway I'm trying to understand why you're talking of <em>two</em> forms of coercion, and whether <code>coerce_hidden</code> corresponds to either.</p>



<a name="148895598"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895598" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895598">(Nov 30 2018 at 22:55)</a>:</h4>
<p>incidentally, I guess we only call <code>instantiate_opaque_types</code> for locals if there is at least one opaque types somewhere within the local's type.</p>



<a name="148895656"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895656" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895656">(Nov 30 2018 at 22:56)</a>:</h4>
<p>I don't really think we want a <em>coercion</em> per se</p>



<a name="148895704"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895704" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895704">(Nov 30 2018 at 22:57)</a>:</h4>
<p>i.e., not the compiler code for cercions</p>



<a name="148895706"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895706" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895706">(Nov 30 2018 at 22:57)</a>:</h4>
<p>but there is a type <em>conversion</em> that is happening</p>



<a name="148895716"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895716" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895716">(Nov 30 2018 at 22:57)</a>:</h4>
<p>if you have:</p>
<div class="codehilite"><pre><span></span>let x: T = &lt;expr&gt;;
</pre></div>


<p>where <code>T</code> involves some <code>impl Trait</code></p>



<a name="148895768"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895768" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895768">(Nov 30 2018 at 22:58)</a>:</h4>
<p>you wind up with two variants of <code>T</code>, one that has inference variables for <code>impl Trait</code>, and one that has opaque values</p>



<a name="148895777"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895777" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895777">(Nov 30 2018 at 22:58)</a>:</h4>
<p>let's call them <code>T_infer</code> and T_opaque`</p>



<a name="148895788"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895788" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895788">(Nov 30 2018 at 22:58)</a>:</h4>
<p>we want to coerce <code>typeof(&lt;expr&gt;)</code> to <code>T_infer</code></p>



<a name="148895792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895792">(Nov 30 2018 at 22:58)</a>:</h4>
<p>but use <code>T_opaque</code> as the type for the pattern <code>x</code></p>



<a name="148895815"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895815" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895815">(Nov 30 2018 at 22:59)</a>:</h4>
<p>then we need in the HAIR/MIR to reflect that "link" somehow to</p>



<a name="148895824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895824">(Nov 30 2018 at 22:59)</a>:</h4>
<p>I think originally I did recommend modifying or at least looking at <code>coercion.rs</code>, but now I think that's  not quite right</p>



<a name="148895882"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895882" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895882">(Nov 30 2018 at 23:00)</a>:</h4>
<p>where did I leave the original set of mentoring instructions, <span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> ?</p>



<a name="148895887"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148895887" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148895887">(Nov 30 2018 at 23:00)</a>:</h4>
<p>(we had an issue for this?)</p>



<a name="148896022"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148896022" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148896022">(Nov 30 2018 at 23:03)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> hmm, on the issue that eddyb filed I think?</p>



<a name="148896027"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148896027" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148896027">(Nov 30 2018 at 23:03)</a>:</h4>
<p>or the subsequent quickfix PR you submitted?</p>



<a name="148896028"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148896028" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148896028">(Nov 30 2018 at 23:03)</a>:</h4>
<p>I forget</p>



<a name="148896313"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148896313" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148896313">(Nov 30 2018 at 23:09)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/54600" target="_blank" title="https://github.com/rust-lang/rust/issues/54600">https://github.com/rust-lang/rust/issues/54600</a></p>



<a name="148896326"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148896326" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148896326">(Nov 30 2018 at 23:09)</a>:</h4>
<p>I have to run now but now that I've refreshed my memory, i'll re-skim those and try to write some updated ones :)</p>



<a name="148896330"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148896330" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148896330">(Nov 30 2018 at 23:09)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> found it: <a href="https://github.com/rust-lang/rust/issues/54600#issuecomment-433049875" target="_blank" title="https://github.com/rust-lang/rust/issues/54600#issuecomment-433049875">https://github.com/rust-lang/rust/issues/54600#issuecomment-433049875</a></p>



<a name="148896335"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148896335" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148896335">(Nov 30 2018 at 23:09)</a>:</h4>
<p>hah</p>



<a name="148896429"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148896429" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148896429">(Nov 30 2018 at 23:10)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> okay, would appreciate that, thanks. if I get started in the meanwhile, how do you recommend I store both the instantiated and original opaque type side-by-side?</p>



<a name="148896430"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148896430" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148896430">(Nov 30 2018 at 23:10)</a>:</h4>
<p>I think the key steps are going to be:</p>
<ul>
<li>in HIR typeck, when type-checking a let, we do the instantiation if the type of a <code>let</code> contains <code>impl trait</code></li>
<li>during HAIR, if the type of a <code>let</code> contains <code>impl tRait</code>, we add a "opacify" node with that type or something</li>
<li>during MIR construction, we convert to a user-type-assertion of some kind that knows it has to instantiate</li>
</ul>
<p>that's about it</p>



<a name="148896444"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148896444" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148896444">(Nov 30 2018 at 23:10)</a>:</h4>
<p>I don't know that you have to store them side-by-side per se</p>



<a name="148896454"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148896454" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148896454">(Nov 30 2018 at 23:11)</a>:</h4>
<p>usually in the writeback phase we record the type we inferred for impl trait</p>



<a name="148896456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148896456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148896456">(Nov 30 2018 at 23:11)</a>:</h4>
<p>so that we can reinstantiate it with that type</p>



<a name="148896471"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148896471" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148896471">(Nov 30 2018 at 23:11)</a>:</h4>
<p>that knows it has to instantiate...what?</p>



<a name="148896476"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148896476" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148896476">(Nov 30 2018 at 23:11)</a>:</h4>
<p>right, I was wondering whether writeback handled it all...</p>



<a name="148896477"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/148896477" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#148896477">(Nov 30 2018 at 23:11)</a>:</h4>
<p>fair enough</p>



<a name="151726261"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726261" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726261">(Dec 13 2018 at 19:31)</a>:</h4>
<p>now... I don't think I need more from you on the impl-trait-in-bindings stuff. I'm only just getting back to working on that now that I've gotten these two PRs out of the way heh.</p>



<a name="151726344"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726344" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726344">(Dec 13 2018 at 19:32)</a>:</h4>
<p>ok :) I can't remember just where we left that</p>



<a name="151726346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726346">(Dec 13 2018 at 19:32)</a>:</h4>
<p>you've left me some good pointers. though I realise you haven't fully made up your mind on all points.</p>



<a name="151726352"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726352" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726352">(Dec 13 2018 at 19:32)</a>:</h4>
<p>yeah, I think I was busily revisiting some of what I had written initially iirc</p>



<a name="151726354"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726354" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726354">(Dec 13 2018 at 19:32)</a>:</h4>
<p>some decisions will require experimentations I think</p>



<a name="151726355"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726355" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726355">(Dec 13 2018 at 19:32)</a>:</h4>
<p>yeah</p>



<a name="151726360"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726360" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726360">(Dec 13 2018 at 19:32)</a>:</h4>
<p>and you weren't quite sure on the nature of coercions needed?</p>



<a name="151726378"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726378" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726378">(Dec 13 2018 at 19:33)</a>:</h4>
<p>ok yes so basically I was saying: I don't think we want to do the "coercion" as part of <a href="http://coerce.rs" target="_blank" title="http://coerce.rs">coerce.rs</a></p>



<a name="151726380"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726380" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726380">(Dec 13 2018 at 19:33)</a>:</h4>
<p>and how distinction should be made between defining and non-defining uses</p>



<a name="151726388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726388">(Dec 13 2018 at 19:33)</a>:</h4>
<p>in this more complex case</p>



<a name="151726399"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726399" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726399">(Dec 13 2018 at 19:33)</a>:</h4>
<p>(it may not be as simple as just a let statement... or will it?)</p>



<a name="151726405"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726405" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726405">(Dec 13 2018 at 19:33)</a>:</h4>
<p>mhm</p>



<a name="151726408"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726408" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726408">(Dec 13 2018 at 19:33)</a>:</h4>
<p>this is somewhat related actually to some of the stuff that we've been wrestling with in <a class="stream" data-stream-id="122657" href="/#narrow/stream/122657-wg-nll">#wg-nll</a> about what precisely <code>let pat: T = ..</code> actually <em>means</em></p>



<a name="151726470"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726470" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726470">(Dec 13 2018 at 19:34)</a>:</h4>
<p>in particular, is the type <code>T</code> a kind of supertype for the right-hand side... or is it specifying the type of the binding in pattern ... or both</p>



<a name="151726478"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726478" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726478">(Dec 13 2018 at 19:34)</a>:</h4>
<p>e.g., <code>let _: T = ...</code> -- here, there is no binding in pattern, so it must be acting as a supertype for the right-hand side</p>



<a name="151726498"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726498" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726498">(Dec 13 2018 at 19:35)</a>:</h4>
<p>aha</p>



<a name="151726502"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726502" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726502">(Dec 13 2018 at 19:35)</a>:</h4>
<p>but if you have <code>let x: &amp;'static u32 = ...</code>, would it be ok for the compiler to assign <code>x</code> a type like <code>&amp;'a u32</code>, since <code>&amp;'static u32 &lt;: &amp;'a u32</code>?</p>



<a name="151726510"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726510" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726510">(Dec 13 2018 at 19:35)</a>:</h4>
<p>probably not, that's sort of surprising</p>



<a name="151726533"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726533" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726533">(Dec 13 2018 at 19:35)</a>:</h4>
<p>anyway, it seems related to me, but maybe it won't come up that much</p>



<a name="151726591"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726591" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726591">(Dec 13 2018 at 19:36)</a>:</h4>
<p>I guess mainly it seems like the "defining use" is the "type(rhs) &lt;: T" test</p>



<a name="151726606"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726606" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726606">(Dec 13 2018 at 19:36)</a>:</h4>
<p>but the type that gets assigned to the bindings in <code>pat</code> uses the "opaque types"</p>



<a name="151726611"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726611" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726611">(Dec 13 2018 at 19:36)</a>:</h4>
<p>so you can see the split again arising</p>



<a name="151726614"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726614" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726614">(Dec 13 2018 at 19:36)</a>:</h4>
<p>well, the opposite sounds fine (i.e. promotion), in certain cases, but that... not so much</p>



<a name="151726662"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726662" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726662">(Dec 13 2018 at 19:37)</a>:</h4>
<p>okay, that seems sensible for a defining use condition</p>



<a name="151726677"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726677" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726677">(Dec 13 2018 at 19:37)</a>:</h4>
<p>so it's like a try-coerce or something, but done during type checking?</p>



<a name="151726789"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726789" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726789">(Dec 13 2018 at 19:39)</a>:</h4>
<p>let's make a new topic I guess</p>



<a name="151726791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726791">(Dec 13 2018 at 19:39)</a>:</h4>
<p>yeah</p>



<a name="151726797"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726797" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726797">(Dec 13 2018 at 19:39)</a>:</h4>
<p>I just thought that. :-P</p>



<a name="151726798"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726798" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726798">(Dec 13 2018 at 19:39)</a>:</h4>
<p>I'll edit these messages actually</p>



<a name="151726817"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726817" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726817">(Dec 13 2018 at 19:39)</a>:</h4>
<p>#impl-trait-in-bindings already exists</p>



<a name="151726825"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726825" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726825">(Dec 13 2018 at 19:39)</a>:</h4>
<p>yep done</p>



<a name="151726826"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726826" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726826">(Dec 13 2018 at 19:39)</a>:</h4>
<p>yep :-)</p>



<a name="151726827"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726827" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726827">(Dec 13 2018 at 19:39)</a>:</h4>
<p>ta</p>



<a name="151726837"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726837" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726837">(Dec 13 2018 at 19:40)</a>:</h4>
<p>so anyway I imagine roughly that in the code which checks <code>let</code></p>



<a name="151726890"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726890" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726890">(Dec 13 2018 at 19:40)</a>:</h4>
<p>It would probably help to collect all your notes (and my musings) in a single place</p>



<a name="151726895"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726895" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726895">(Dec 13 2018 at 19:40)</a>:</h4>
<p>we would want to inspect if (a) there is a type annotation and (b) that type references opaque types</p>



<a name="151726901"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726901" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726901">(Dec 13 2018 at 19:40)</a>:</h4>
<p>maybe a collaborative MD doc like you were starting</p>



<a name="151726909"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726909" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726909">(Dec 13 2018 at 19:40)</a>:</h4>
<p>not a bad idea</p>



<a name="151726914"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726914" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726914">(Dec 13 2018 at 19:40)</a>:</h4>
<p>right now they're in a few GH issues, PRs, and Zulip I feel</p>



<a name="151726917"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726917" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726917">(Dec 13 2018 at 19:40)</a>:</h4>
<p>yeah</p>



<a name="151726928"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726928" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726928">(Dec 13 2018 at 19:40)</a>:</h4>
<p>always hard to figure out how to organize such things</p>



<a name="151726933"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726933" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726933">(Dec 13 2018 at 19:40)</a>:</h4>
<p>indeed</p>



<a name="151726984"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726984" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726984">(Dec 13 2018 at 19:41)</a>:</h4>
<p>can I let you do that later? since you probably understand your notes rather better than I do!</p>



<a name="151726988"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151726988" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151726988">(Dec 13 2018 at 19:41)</a>:</h4>
<p>and the topic in general</p>



<a name="151727054"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727054" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727054">(Dec 13 2018 at 19:42)</a>:</h4>
<p>but, about code that checks <code>let</code>...<br>
"we would want to inspect if (a) there is a type annotation and (b) that type references opaque types" -- right</p>



<a name="151727055"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727055" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727055">(Dec 13 2018 at 19:42)</a>:</h4>
<p>yeah</p>



<a name="151727078"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727078" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727078">(Dec 13 2018 at 19:42)</a>:</h4>
<p>yes, and basically if those things are true, we'd instantiate said opaque types...</p>



<a name="151727086"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727086" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727086">(Dec 13 2018 at 19:42)</a>:</h4>
<p>okay</p>



<a name="151727098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727098">(Dec 13 2018 at 19:42)</a>:</h4>
<p>winding up with another variant of the type that is used with the RHS</p>



<a name="151727105"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727105" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727105">(Dec 13 2018 at 19:42)</a>:</h4>
<p>do we check for "type(rhs) &lt;: T" at that point too though?</p>



<a name="151727108"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727108" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727108">(Dec 13 2018 at 19:42)</a>:</h4>
<p>that's the high-level idea anyway</p>



<a name="151727131"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727131" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727131">(Dec 13 2018 at 19:43)</a>:</h4>
<p>I guess that's already part of assignment type checking?</p>



<a name="151727151"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727151" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727151">(Dec 13 2018 at 19:43)</a>:</h4>
<p>or maybe I misunderstand</p>



<a name="151727300"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727300" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727300">(Dec 13 2018 at 19:45)</a>:</h4>
<p><span class="user-mention" data-user-id="124069">@Alexander Regueiro</span> I think we would be adding this into <a href="https://github.com/rust-lang/rust/blob/7489ee9c6f92050a12a3a3097df0a7d3737d82ec/src/librustc_typeck/check/mod.rs#L4513-L4539" target="_blank" title="https://github.com/rust-lang/rust/blob/7489ee9c6f92050a12a3a3097df0a7d3737d82ec/src/librustc_typeck/check/mod.rs#L4513-L4539">the <code>check_decl_initializer</code> function here</a></p>



<a name="151727313"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727313" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727313">(Dec 13 2018 at 19:45)</a>:</h4>
<p>right, I'm familiar with that</p>



<a name="151727316"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727316" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727316">(Dec 13 2018 at 19:45)</a>:</h4>
<p>or possible <a href="https://github.com/rust-lang/rust/blob/7489ee9c6f92050a12a3a3097df0a7d3737d82ec/src/librustc_typeck/check/mod.rs#L4541" target="_blank" title="https://github.com/rust-lang/rust/blob/7489ee9c6f92050a12a3a3097df0a7d3737d82ec/src/librustc_typeck/check/mod.rs#L4541"><code>check_decl_local</code></a></p>



<a name="151727328"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727328" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727328">(Dec 13 2018 at 19:45)</a>:</h4>
<p>but do we need an additional subtype check?</p>



<a name="151727332"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727332" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727332">(Dec 13 2018 at 19:45)</a>:</h4>
<p>like above</p>



<a name="151727394"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727394" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727394">(Dec 13 2018 at 19:46)</a>:</h4>
<p>no we would be using <a href="https://github.com/rust-lang/rust/blob/7489ee9c6f92050a12a3a3097df0a7d3737d82ec/src/librustc_typeck/check/mod.rs#L4537" target="_blank" title="https://github.com/rust-lang/rust/blob/7489ee9c6f92050a12a3a3097df0a7d3737d82ec/src/librustc_typeck/check/mod.rs#L4537">this same check that already exists</a>,</p>



<a name="151727404"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727404" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727404">(Dec 13 2018 at 19:46)</a>:</h4>
<p>except that the type we are using would not be the type the user wrote</p>



<a name="151727410"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727410" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727410">(Dec 13 2018 at 19:46)</a>:</h4>
<p>but rather the 'instantiated' version</p>



<a name="151727429"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727429" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727429">(Dec 13 2018 at 19:46)</a>:</h4>
<p>this logic may actually already be sort of correct I guess</p>



<a name="151727437"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727437" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727437">(Dec 13 2018 at 19:46)</a>:</h4>
<p>I mean there is <code>revealed_ty</code></p>



<a name="151727485"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727485" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727485">(Dec 13 2018 at 19:47)</a>:</h4>
<p>so yeah the type-checker part maybe doesn't have to change at all</p>



<a name="151727544"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727544" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727544">(Dec 13 2018 at 19:48)</a>:</h4>
<p>or maybe only minimally</p>



<a name="151727554"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727554" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727554">(Dec 13 2018 at 19:48)</a>:</h4>
<p>the question is more how to ensure this "cast" winds up in the MIR</p>



<a name="151727558"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727558" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727558">(Dec 13 2018 at 19:48)</a>:</h4>
<p>presumably it also wants to be added to the HAIR</p>



<a name="151727570"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727570" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727570">(Dec 13 2018 at 19:49)</a>:</h4>
<p>makes sense</p>



<a name="151727587"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727587" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727587">(Dec 13 2018 at 19:49)</a>:</h4>
<p>I kind of wrote that code before, with my initial attempt</p>



<a name="151727628"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727628" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727628">(Dec 13 2018 at 19:49)</a>:</h4>
<p>right</p>



<a name="151727678"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727678" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727678">(Dec 13 2018 at 19:50)</a>:</h4>
<p>I wonder if MIR needs to do its own type-checking to make sure the cast is valid?</p>



<a name="151727690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727690">(Dec 13 2018 at 19:50)</a>:</h4>
<p>so maybe what we want is to modify the <a href="https://github.com/rust-lang/rust/blob/7489ee9c6f92050a12a3a3097df0a7d3737d82ec/src/librustc_mir/hair/cx/block.rs#L81" target="_blank" title="https://github.com/rust-lang/rust/blob/7489ee9c6f92050a12a3a3097df0a7d3737d82ec/src/librustc_mir/hair/cx/block.rs#L81">HAIR lowering for <code>let</code></a></p>



<a name="151727693"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727693" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727693">(Dec 13 2018 at 19:50)</a>:</h4>
<p>hmm</p>



<a name="151727700"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727700" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727700">(Dec 13 2018 at 19:50)</a>:</h4>
<p>good idea</p>



<a name="151727718"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727718" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727718">(Dec 13 2018 at 19:50)</a>:</h4>
<p>so</p>



<a name="151727739"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727739" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727739">(Dec 13 2018 at 19:51)</a>:</h4>
<p>you can see that we already put the user-given type into the pattern, <a href="https://github.com/rust-lang/rust/blob/7489ee9c6f92050a12a3a3097df0a7d3737d82ec/src/librustc_mir/hair/cx/block.rs#L90-L102" target="_blank" title="https://github.com/rust-lang/rust/blob/7489ee9c6f92050a12a3a3097df0a7d3737d82ec/src/librustc_mir/hair/cx/block.rs#L90-L102">here</a></p>



<a name="151727768"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727768" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727768">(Dec 13 2018 at 19:51)</a>:</h4>
<p>we might want to do something similar, afterwards, basically wrapping the <code>initializer</code> with some kind of <code>HideUserType</code> sort of thing</p>



<a name="151727779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727779">(Dec 13 2018 at 19:51)</a>:</h4>
<p>yep</p>



<a name="151727785"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727785" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727785">(Dec 13 2018 at 19:51)</a>:</h4>
<p>(presuming that impl trait is present)</p>



<a name="151727789"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727789" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727789">(Dec 13 2018 at 19:52)</a>:</h4>
<p>this would then be converted into some suitable MIR cast</p>



<a name="151727847"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727847" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727847">(Dec 13 2018 at 19:52)</a>:</h4>
<p>which the type-checker would know to instantiate the opaque types etc</p>



<a name="151727857"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727857" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727857">(Dec 13 2018 at 19:52)</a>:</h4>
<p>yeah... probably I can reuse the MIR code I've written for that, or something similar.</p>



<a name="151727871"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727871" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727871">(Dec 13 2018 at 19:52)</a>:</h4>
<p>the MIR type checker you mean?</p>



<a name="151727891"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727891" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727891">(Dec 13 2018 at 19:52)</a>:</h4>
<blockquote>
<p>we might want to do something similar, afterwards, basically wrapping the <code>initializer</code> with some kind of <code>HideUserType</code> sort of thing</p>
</blockquote>
<p>this btw gets back to that point about the type annotation serving two roles: you see it appearing (in opaque form) as an ascription on the pattern, and then in the cast (the revealed form)</p>



<a name="151727896"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727896" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727896">(Dec 13 2018 at 19:52)</a>:</h4>
<blockquote>
<p>the MIR type checker you mean?</p>
</blockquote>
<p>yes</p>



<a name="151727897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727897">(Dec 13 2018 at 19:53)</a>:</h4>
<blockquote>
<p>yeah... probably I can reuse the MIR code I've written for that, or something similar.</p>
</blockquote>
<p>yes</p>



<a name="151727912"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727912" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727912">(Dec 13 2018 at 19:53)</a>:</h4>
<p>makes sense</p>



<a name="151727913"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727913" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727913">(Dec 13 2018 at 19:53)</a>:</h4>
<p>the basic code structure you had was right, it was just not necessarily triggering at the right times</p>



<a name="151727916"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727916" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727916">(Dec 13 2018 at 19:53)</a>:</h4>
<p>okay. appreciate that. that's enough for now I think. :-)</p>



<a name="151727920"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727920" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727920">(Dec 13 2018 at 19:53)</a>:</h4>
<p>awesome</p>



<a name="151727923"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727923" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727923">(Dec 13 2018 at 19:53)</a>:</h4>
<p>at least, until you get around to collating your notes</p>



<a name="151727941"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727941" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727941">(Dec 13 2018 at 19:53)</a>:</h4>
<p>yep, I'll try to find some suitable github place for them -- or, maybe better yet, we can put some of this logic into a rustc-guide PR</p>



<a name="151727966"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727966" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727966">(Dec 13 2018 at 19:54)</a>:</h4>
<p>hmm I wonder if having rustc-guide PRs that stay open and get updated as we shift the design actually makes sense</p>



<a name="151727989"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727989" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727989">(Dec 13 2018 at 19:54)</a>:</h4>
<p>kind of "design guide in progress"</p>



<a name="151727991"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151727991" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151727991">(Dec 13 2018 at 19:54)</a>:</h4>
<p>and/or land and get edited</p>



<a name="151728002"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151728002" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151728002">(Dec 13 2018 at 19:54)</a>:</h4>
<p>ok, gotta run anyway, meeting time</p>



<a name="151728218"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151728218" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151728218">(Dec 13 2018 at 19:57)</a>:</h4>
<p>yeah that could work :-)</p>



<a name="151728235"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/impl-trait-in-bindings/near/151728235" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/impl-trait-in-bindings.html#151728235">(Dec 13 2018 at 19:57)</a>:</h4>
<p>and sure. I've left you some PMs, btw.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>